package book;

//书架
public class BookShelf {
    //书架需要放书，那么需要创建一个数组
    private Book[] books;//在构造方法中进行初始化
    private int size;//使用size对有效数据进行管理

    public int getSize() {
        return this.size;
    }
    public Book[] getBookShelf() {
        return this.books;
    }
    public void setSize(int size) {
        this.size = size;
    }
    public void setBooks(Book[] books) {
        this.books = books;
    }

    //构造方法
    public BookShelf() {
        //在构造时直接加上三本书
        books = new Book[3];
        Book bookOne = new Book("三国演义", "罗贯中", 59.99);
        books[0] = bookOne;
        Book bookTwo = new Book("西游记", "吴承恩", 45.99);
        books[1] = bookTwo;
        Book bookThree = new Book("水浒传", "施耐庵", 57.99);
        books[2] = bookThree;
        size = 3;
    }
}
